

public class Circle extends Shape{
    private int r;

    public Circle() {
    }
 
    public Circle(String name,int r) {
       super(name);
       this.r =r;
    }
 
    public void show() {
       System.out.println("name"+getName()+"半径："+r);
    }
//继承了有抽象方法的父类 子类必须重写父类所有的抽象方法
    @Override
    public double getArea(){
        return Math.PI*r*r;
    }
}
